|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Ws4J2eeServerCLOptionParser.java | 23.3% | 22.3% | 42.3% | 24.9% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.toWs;
|
|
18 |
|
|
19 |
import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
|
|
20 |
import org.apache.axis.encoding.DefaultTypeMappingImpl;
|
|
21 |
import org.apache.axis.i18n.Messages;
|
|
22 |
import org.apache.axis.utils.CLArgsParser;
|
|
23 |
import org.apache.axis.utils.CLOption;
|
|
24 |
import org.apache.axis.utils.CLOptionDescriptor;
|
|
25 |
import org.apache.axis.utils.CLUtil;
|
|
26 |
import org.apache.axis.utils.ClassUtils;
|
|
27 |
import org.apache.axis.wsdl.fromJava.Emitter;
|
|
28 |
import org.apache.geronimo.ews.ws4j2ee.module.Module;
|
|
29 |
import org.apache.geronimo.ews.ws4j2ee.module.ModuleFactory;
|
|
30 |
import org.apache.axis.encoding.TypeMappingRegistryImpl;
|
|
31 |
|
|
32 |
import java.io.File;
|
|
33 |
import java.util.HashMap;
|
|
34 |
import java.util.List;
|
|
35 |
import java.util.Map;
|
|
36 |
|
|
37 |
/**
|
|
38 |
* @author hemapani
|
|
39 |
*/
|
|
40 |
public class Ws4J2eeServerCLOptionParser implements Ws4J2eeDeployContext { |
|
41 |
private Module module;
|
|
42 |
private String outPutLocation;
|
|
43 |
private String moduleLocation = null; |
|
44 |
private String implStyle = GenerationConstants.USE_LOCAL_AND_REMOTE;
|
|
45 |
private String container = GenerationConstants.JBOSS_CONTAINER;
|
|
46 |
|
|
47 |
private String[] args;
|
|
48 |
private int indexToChange = -1; |
|
49 |
|
|
50 |
/**
|
|
51 |
* @return
|
|
52 |
*/
|
|
53 | 11 |
public String getOutPutLocation() {
|
54 | 11 |
return outPutLocation;
|
55 |
} |
|
56 |
|
|
57 |
/**
|
|
58 |
* @param string
|
|
59 |
*/
|
|
60 | 0 |
public void setOutPutLocation(String string) { |
61 | 0 |
outPutLocation = string; |
62 |
} |
|
63 |
///////////////////////////////////////////////////////////////////
|
|
64 |
// Define our short one-letter option identifiers.
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Field INHERITED_CLASS_OPT
|
|
68 |
*/
|
|
69 |
protected static final int INHERITED_CLASS_OPT = 'a'; |
|
70 |
|
|
71 |
/**
|
|
72 |
* Field SOAPACTION_OPT
|
|
73 |
*/
|
|
74 |
protected static final int SOAPACTION_OPT = 'A'; |
|
75 |
|
|
76 |
/**
|
|
77 |
* Field BINDING_NAME_OPT
|
|
78 |
*/
|
|
79 |
protected static final int BINDING_NAME_OPT = 'b'; |
|
80 |
|
|
81 |
/**
|
|
82 |
* Field STOP_CLASSES_OPT
|
|
83 |
*/
|
|
84 |
protected static final int STOP_CLASSES_OPT = 'c'; |
|
85 |
|
|
86 |
/**
|
|
87 |
* Field IMPORT_SCHEMA_OPT
|
|
88 |
*/
|
|
89 |
protected static final int IMPORT_SCHEMA_OPT = 'C'; |
|
90 |
|
|
91 |
/**
|
|
92 |
* Field EXTRA_CLASSES_OPT
|
|
93 |
*/
|
|
94 |
protected static final int EXTRA_CLASSES_OPT = 'e'; |
|
95 |
|
|
96 |
/**
|
|
97 |
* Field HELP_OPT
|
|
98 |
*/
|
|
99 |
protected static final int HELP_OPT = 'h'; |
|
100 |
|
|
101 |
/**
|
|
102 |
* Field IMPL_CLASS_OPT
|
|
103 |
*/
|
|
104 |
protected static final int IMPL_CLASS_OPT = 'i'; |
|
105 |
|
|
106 |
/**
|
|
107 |
* Field INPUT_OPT
|
|
108 |
*/
|
|
109 |
protected static final int INPUT_OPT = 'I'; |
|
110 |
|
|
111 |
/**
|
|
112 |
* Field LOCATION_OPT
|
|
113 |
*/
|
|
114 |
protected static final int LOCATION_OPT = 'l'; |
|
115 |
|
|
116 |
/**
|
|
117 |
* Field LOCATION_IMPORT_OPT
|
|
118 |
*/
|
|
119 |
protected static final int LOCATION_IMPORT_OPT = 'L'; |
|
120 |
|
|
121 |
/**
|
|
122 |
* Field METHODS_ALLOWED_OPT
|
|
123 |
*/
|
|
124 |
protected static final int METHODS_ALLOWED_OPT = 'm'; |
|
125 |
|
|
126 |
/**
|
|
127 |
* Field NAMESPACE_OPT
|
|
128 |
*/
|
|
129 |
protected static final int NAMESPACE_OPT = 'n'; |
|
130 |
|
|
131 |
/**
|
|
132 |
* Field NAMESPACE_IMPL_OPT
|
|
133 |
*/
|
|
134 |
protected static final int NAMESPACE_IMPL_OPT = 'N'; |
|
135 |
|
|
136 |
/**
|
|
137 |
* Field OUTPUT_OPT
|
|
138 |
*/
|
|
139 |
protected static final int OUTPUT_OPT = 'o'; |
|
140 |
|
|
141 |
/**
|
|
142 |
* Field OUTPUT_IMPL_OPT
|
|
143 |
*/
|
|
144 |
protected static final int OUTPUT_IMPL_OPT = 'O'; |
|
145 |
|
|
146 |
/**
|
|
147 |
* Field PACKAGE_OPT
|
|
148 |
*/
|
|
149 |
protected static final int PACKAGE_OPT = 'p'; |
|
150 |
|
|
151 |
/**
|
|
152 |
* Field PORTTYPE_NAME_OPT
|
|
153 |
*/
|
|
154 |
protected static final int PORTTYPE_NAME_OPT = 'P'; |
|
155 |
|
|
156 |
/**
|
|
157 |
* Field SERVICE_PORT_NAME_OPT
|
|
158 |
*/
|
|
159 |
protected static final int SERVICE_PORT_NAME_OPT = 's'; |
|
160 |
|
|
161 |
/**
|
|
162 |
* Field SERVICE_ELEMENT_NAME_OPT
|
|
163 |
*/
|
|
164 |
protected static final int SERVICE_ELEMENT_NAME_OPT = 'S'; |
|
165 |
|
|
166 |
/**
|
|
167 |
* Field TYPEMAPPING_OPT
|
|
168 |
*/
|
|
169 |
protected static final int TYPEMAPPING_OPT = 'T'; |
|
170 |
|
|
171 |
/**
|
|
172 |
* Field USE_OPT
|
|
173 |
*/
|
|
174 |
protected static final int USE_OPT = 'u'; |
|
175 |
|
|
176 |
/**
|
|
177 |
* Field OUTPUT_WSDL_MODE_OPT
|
|
178 |
*/
|
|
179 |
protected static final int OUTPUT_WSDL_MODE_OPT = 'w'; |
|
180 |
|
|
181 |
/**
|
|
182 |
* Field METHODS_NOTALLOWED_OPT
|
|
183 |
*/
|
|
184 |
protected static final int METHODS_NOTALLOWED_OPT = 'x'; |
|
185 |
|
|
186 |
protected static final int CLASSPATH_OPT = 'X'; |
|
187 |
|
|
188 |
/**
|
|
189 |
* Field STYLE_OPT
|
|
190 |
*/
|
|
191 |
protected static final int STYLE_OPT = 'y'; |
|
192 |
|
|
193 |
protected static final int IMPL_STYLE_OPT = 'E'; |
|
194 |
protected static final int CONTAINER_OPT = 'J'; |
|
195 |
|
|
196 |
/**
|
|
197 |
* Define the understood options. Each CLOptionDescriptor contains:
|
|
198 |
* - The "long" version of the option. Eg, "help" means that "--help" will
|
|
199 |
* be recognised.
|
|
200 |
* - The option flags, governing the option's argument(s).
|
|
201 |
* - The "short" version of the option. Eg, 'h' means that "-h" will be
|
|
202 |
* recognised.
|
|
203 |
* - A description of the option for the usage message
|
|
204 |
*/
|
|
205 |
protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{ |
|
206 |
new CLOptionDescriptor("help", CLOptionDescriptor.ARGUMENT_DISALLOWED, |
|
207 |
HELP_OPT, Messages.getMessage("j2wopthelp00")),
|
|
208 |
new CLOptionDescriptor("input", CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
209 |
INPUT_OPT, Messages.getMessage("j2woptinput00")),
|
|
210 |
new CLOptionDescriptor("output", CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
211 |
OUTPUT_OPT, |
|
212 |
Messages.getMessage("j2woptoutput00")),
|
|
213 |
new CLOptionDescriptor("location", |
|
214 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
215 |
LOCATION_OPT, |
|
216 |
Messages.getMessage("j2woptlocation00")),
|
|
217 |
new CLOptionDescriptor("portTypeName", |
|
218 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
219 |
PORTTYPE_NAME_OPT, |
|
220 |
Messages.getMessage("j2woptportTypeName00")),
|
|
221 |
new CLOptionDescriptor("bindingName", |
|
222 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
223 |
BINDING_NAME_OPT, |
|
224 |
Messages.getMessage("j2woptbindingName00")),
|
|
225 |
new CLOptionDescriptor("serviceElementName", CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
226 |
SERVICE_ELEMENT_NAME_OPT, |
|
227 |
Messages.getMessage("j2woptserviceElementName00")),
|
|
228 |
new CLOptionDescriptor("servicePortName", |
|
229 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
230 |
SERVICE_PORT_NAME_OPT, |
|
231 |
Messages.getMessage("j2woptservicePortName00")),
|
|
232 |
new CLOptionDescriptor("namespace", |
|
233 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
234 |
NAMESPACE_OPT, |
|
235 |
Messages.getMessage("j2woptnamespace00")),
|
|
236 |
new CLOptionDescriptor("PkgtoNS", |
|
237 |
CLOptionDescriptor.DUPLICATES_ALLOWED |
|
238 |
+ CLOptionDescriptor.ARGUMENTS_REQUIRED_2, |
|
239 |
PACKAGE_OPT, |
|
240 |
Messages.getMessage("j2woptPkgtoNS00")),
|
|
241 |
new CLOptionDescriptor("methods", |
|
242 |
CLOptionDescriptor.DUPLICATES_ALLOWED |
|
243 |
+ CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
244 |
METHODS_ALLOWED_OPT, |
|
245 |
Messages.getMessage("j2woptmethods00")),
|
|
246 |
new CLOptionDescriptor("all", CLOptionDescriptor.ARGUMENT_DISALLOWED, |
|
247 |
INHERITED_CLASS_OPT, |
|
248 |
Messages.getMessage("j2woptall00")),
|
|
249 |
new CLOptionDescriptor("outputWsdlMode", |
|
250 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
251 |
OUTPUT_WSDL_MODE_OPT, |
|
252 |
Messages.getMessage("j2woptoutputWsdlMode00")),
|
|
253 |
new CLOptionDescriptor("locationImport", |
|
254 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
255 |
LOCATION_IMPORT_OPT, |
|
256 |
Messages.getMessage("j2woptlocationImport00")),
|
|
257 |
new CLOptionDescriptor("namespaceImpl", |
|
258 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
259 |
NAMESPACE_IMPL_OPT, |
|
260 |
Messages.getMessage("j2woptnamespaceImpl00")),
|
|
261 |
new CLOptionDescriptor("outputImpl", |
|
262 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
263 |
OUTPUT_IMPL_OPT, |
|
264 |
Messages.getMessage("j2woptoutputImpl00")),
|
|
265 |
new CLOptionDescriptor("implClass", |
|
266 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
267 |
IMPL_CLASS_OPT, |
|
268 |
Messages.getMessage("j2woptimplClass00")),
|
|
269 |
new CLOptionDescriptor("exclude", |
|
270 |
CLOptionDescriptor.DUPLICATES_ALLOWED |
|
271 |
+ CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
272 |
METHODS_NOTALLOWED_OPT, |
|
273 |
Messages.getMessage("j2woptexclude00")),
|
|
274 |
new CLOptionDescriptor("stopClasses", |
|
275 |
CLOptionDescriptor.DUPLICATES_ALLOWED |
|
276 |
+ CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
277 |
STOP_CLASSES_OPT, |
|
278 |
Messages.getMessage("j2woptstopClass00")),
|
|
279 |
new CLOptionDescriptor("typeMappingVersion", |
|
280 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
281 |
TYPEMAPPING_OPT, |
|
282 |
Messages.getMessage("j2wopttypeMapping00")),
|
|
283 |
new CLOptionDescriptor("soapAction", |
|
284 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
285 |
SOAPACTION_OPT, |
|
286 |
Messages.getMessage("j2woptsoapAction00")),
|
|
287 |
new CLOptionDescriptor("style", CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
288 |
STYLE_OPT, Messages.getMessage("j2woptStyle00")),
|
|
289 |
new CLOptionDescriptor("use", CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
290 |
USE_OPT, Messages.getMessage("j2woptUse00")),
|
|
291 |
new CLOptionDescriptor("extraClasses", |
|
292 |
CLOptionDescriptor.DUPLICATES_ALLOWED |
|
293 |
+ CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
294 |
EXTRA_CLASSES_OPT, |
|
295 |
Messages.getMessage("j2woptExtraClasses00")),
|
|
296 |
new CLOptionDescriptor("importSchema", |
|
297 |
CLOptionDescriptor.ARGUMENT_OPTIONAL, |
|
298 |
IMPORT_SCHEMA_OPT, |
|
299 |
Messages.getMessage("j2woptImportSchema00")),
|
|
300 |
new CLOptionDescriptor("classpath", |
|
301 |
CLOptionDescriptor.ARGUMENT_OPTIONAL, |
|
302 |
CLASSPATH_OPT, |
|
303 |
Messages.getMessage("optionClasspath")),
|
|
304 |
new CLOptionDescriptor("implStyle", |
|
305 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
306 |
IMPL_STYLE_OPT, |
|
307 |
"impelemtation Style"),
|
|
308 |
new CLOptionDescriptor("container", |
|
309 |
CLOptionDescriptor.ARGUMENT_REQUIRED, |
|
310 |
CONTAINER_OPT, |
|
311 |
"the J2EE contianer")
|
|
312 |
}; |
|
313 |
|
|
314 |
/**
|
|
315 |
* Field emitter
|
|
316 |
*/
|
|
317 |
protected Emitter emitter;
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Field className
|
|
321 |
*/
|
|
322 |
protected String className = null; |
|
323 |
|
|
324 |
/**
|
|
325 |
* Field wsdlFilename
|
|
326 |
*/
|
|
327 |
protected String wsdlFilename = null; |
|
328 |
|
|
329 |
/**
|
|
330 |
* Field wsdlImplFilename
|
|
331 |
*/
|
|
332 |
protected String wsdlImplFilename = null; |
|
333 |
|
|
334 |
/**
|
|
335 |
* Field namespaceMap
|
|
336 |
*/
|
|
337 |
protected HashMap namespaceMap = new HashMap(); |
|
338 |
|
|
339 |
/**
|
|
340 |
* Field mode
|
|
341 |
*/
|
|
342 |
protected int mode = Emitter.MODE_ALL; |
|
343 |
|
|
344 |
/**
|
|
345 |
* Field locationSet
|
|
346 |
*/
|
|
347 |
boolean locationSet = false; |
|
348 |
|
|
349 |
/**
|
|
350 |
* Instantiate a Java2WSDL emitter.
|
|
351 |
*/
|
|
352 | 11 |
public Ws4J2eeServerCLOptionParser(String[] args, Emitter emitter) {
|
353 | 11 |
this.emitter = emitter;
|
354 |
// Parse the arguments
|
|
355 | 11 |
CLArgsParser argsParser = new CLArgsParser(args, options);
|
356 |
|
|
357 |
// Print parser errors, if any
|
|
358 | 11 |
if (null != argsParser.getErrorString()) { |
359 | 0 |
System.err.println(Messages.getMessage("j2werror00", argsParser.getErrorString()));
|
360 | 0 |
printUsage(); |
361 | 0 |
return;
|
362 |
} |
|
363 |
|
|
364 |
// Get a list of parsed options
|
|
365 | 11 |
List clOptions = argsParser.getArguments(); |
366 | 11 |
int size = clOptions.size();
|
367 |
// Parse the options and configure the emitter as appropriate.
|
|
368 | 11 |
for (int i = 0; i < size; i++) { |
369 | 25 |
if (parseOption((CLOption) clOptions.get(i)) == false) { |
370 | 0 |
return;
|
371 |
} |
|
372 |
} |
|
373 | 11 |
module = ModuleFactory.createPackageModule(moduleLocation,new File(outPutLocation));
|
374 |
|
|
375 |
// validate argument combinations
|
|
376 | 11 |
if (validateOptions() == false) { |
377 | 0 |
return;
|
378 |
} |
|
379 |
|
|
380 |
// Set the namespace map
|
|
381 | 11 |
if (!namespaceMap.isEmpty()) {
|
382 | 0 |
emitter.setNamespaceMap(namespaceMap); |
383 |
} |
|
384 |
} // ctor
|
|
385 |
|
|
386 | 0 |
public Ws4J2eeServerCLOptionParser(Emitter emitter) {
|
387 | 0 |
this.emitter = emitter;
|
388 | 0 |
emitter.setLocationUrl("http://127.0.0.1");
|
389 |
} |
|
390 |
|
|
391 |
/**
|
|
392 |
* addOptions
|
|
393 |
* Add option descriptions to the tool. Allows
|
|
394 |
* extended classes to add additional options.
|
|
395 |
*
|
|
396 |
* @param newOptions CLOptionDescriptor[] the options
|
|
397 |
*/
|
|
398 | 0 |
protected void addOptions(CLOptionDescriptor[] newOptions) { |
399 | 0 |
if ((newOptions != null) && (newOptions.length > 0)) { |
400 | 0 |
CLOptionDescriptor[] allOptions = |
401 |
new CLOptionDescriptor[options.length + newOptions.length];
|
|
402 | 0 |
System.arraycopy(options, 0, allOptions, 0, options.length); |
403 | 0 |
System.arraycopy(newOptions, 0, allOptions, options.length, |
404 |
newOptions.length); |
|
405 | 0 |
options = allOptions; |
406 |
} |
|
407 |
} |
|
408 |
|
|
409 |
/**
|
|
410 |
* Parse an option
|
|
411 |
*
|
|
412 |
* @param option CLOption is the option
|
|
413 |
* @return
|
|
414 |
*/
|
|
415 | 25 |
protected boolean parseOption(CLOption option) { |
416 | 25 |
String value; |
417 | 25 |
boolean status = true; |
418 | 25 |
switch (option.getId()) {
|
419 |
case CLOption.TEXT_ARGUMENT:
|
|
420 | 11 |
if (moduleLocation != null) { |
421 | 0 |
System.out.println(Messages.getMessage("j2wDuplicateClass00", className,
|
422 |
option.getArgument())); |
|
423 | 0 |
printUsage(); |
424 | 0 |
status = false; // error |
425 |
} |
|
426 | 11 |
moduleLocation = option.getArgument(); |
427 |
|
|
428 | 11 |
break;
|
429 |
case METHODS_ALLOWED_OPT:
|
|
430 | 0 |
emitter.setAllowedMethods(option.getArgument()); |
431 | 0 |
break;
|
432 |
case INHERITED_CLASS_OPT:
|
|
433 | 0 |
emitter.setUseInheritedMethods(true);
|
434 | 0 |
break;
|
435 |
case IMPL_CLASS_OPT:
|
|
436 | 0 |
emitter.setImplCls(option.getArgument()); |
437 | 0 |
break;
|
438 |
case HELP_OPT:
|
|
439 | 0 |
printUsage(); |
440 | 0 |
status = false;
|
441 | 0 |
break;
|
442 |
case OUTPUT_WSDL_MODE_OPT:
|
|
443 | 0 |
String modeArg = option.getArgument(); |
444 | 0 |
if ("All".equalsIgnoreCase(modeArg)) { |
445 | 0 |
mode = Emitter.MODE_ALL; |
446 | 0 |
} else if ("Interface".equalsIgnoreCase(modeArg)) { |
447 | 0 |
mode = Emitter.MODE_INTERFACE; |
448 | 0 |
} else if ("Implementation".equalsIgnoreCase(modeArg)) { |
449 | 0 |
mode = Emitter.MODE_IMPLEMENTATION; |
450 |
} else {
|
|
451 | 0 |
mode = Emitter.MODE_ALL; |
452 | 0 |
System.err.println(Messages.getMessage("j2wmodeerror",
|
453 |
modeArg)); |
|
454 |
} |
|
455 | 0 |
break;
|
456 |
case OUTPUT_OPT:
|
|
457 | 11 |
outPutLocation = option.getArgument(); |
458 | 11 |
wsdlFilename = option.getArgument(); |
459 | 11 |
break;
|
460 |
case INPUT_OPT:
|
|
461 | 0 |
emitter.setInputWSDL(option.getArgument()); |
462 | 0 |
break;
|
463 |
case OUTPUT_IMPL_OPT:
|
|
464 | 0 |
wsdlImplFilename = option.getArgument(); |
465 | 0 |
break;
|
466 |
case PACKAGE_OPT:
|
|
467 | 0 |
String packageName = option.getArgument(0); |
468 | 0 |
String namespace = option.getArgument(1); |
469 | 0 |
namespaceMap.put(packageName, namespace); |
470 | 0 |
break;
|
471 |
case NAMESPACE_OPT:
|
|
472 | 0 |
emitter.setIntfNamespace(option.getArgument()); |
473 | 0 |
break;
|
474 |
case NAMESPACE_IMPL_OPT:
|
|
475 | 0 |
emitter.setImplNamespace(option.getArgument()); |
476 | 0 |
break;
|
477 |
case SERVICE_ELEMENT_NAME_OPT:
|
|
478 | 0 |
emitter.setServiceElementName(option.getArgument()); |
479 | 0 |
break;
|
480 |
case SERVICE_PORT_NAME_OPT:
|
|
481 | 0 |
emitter.setServicePortName(option.getArgument()); |
482 | 0 |
break;
|
483 |
case LOCATION_OPT:
|
|
484 | 3 |
emitter.setLocationUrl(option.getArgument()); |
485 | 3 |
locationSet = true;
|
486 | 3 |
break;
|
487 |
case LOCATION_IMPORT_OPT:
|
|
488 | 0 |
emitter.setImportUrl(option.getArgument()); |
489 | 0 |
break;
|
490 |
case METHODS_NOTALLOWED_OPT:
|
|
491 | 0 |
emitter.setDisallowedMethods(option.getArgument()); |
492 | 0 |
break;
|
493 |
case PORTTYPE_NAME_OPT:
|
|
494 | 0 |
emitter.setPortTypeName(option.getArgument()); |
495 | 0 |
break;
|
496 |
case BINDING_NAME_OPT:
|
|
497 | 0 |
emitter.setBindingName(option.getArgument()); |
498 | 0 |
break;
|
499 |
case STOP_CLASSES_OPT:
|
|
500 | 0 |
emitter.setStopClasses(option.getArgument()); |
501 | 0 |
break;
|
502 |
case TYPEMAPPING_OPT:
|
|
503 | 0 |
value = option.getArgument(); |
504 | 0 |
TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
|
505 | 0 |
tmr.doRegisterFromVersion(value); |
506 | 0 |
emitter.setTypeMappingRegistry(tmr); |
507 | 0 |
break;
|
508 |
case SOAPACTION_OPT:
|
|
509 | 0 |
value = option.getArgument(); |
510 | 0 |
if (value.equalsIgnoreCase("DEFAULT")) { |
511 | 0 |
emitter.setSoapAction("DEFAULT");
|
512 | 0 |
} else if (value.equalsIgnoreCase("OPERATION")) { |
513 | 0 |
emitter.setSoapAction("OPERATION");
|
514 | 0 |
} else if (value.equalsIgnoreCase("NONE")) { |
515 | 0 |
emitter.setSoapAction("NONE");
|
516 |
} else {
|
|
517 | 0 |
System.out.println(Messages.getMessage("j2wBadSoapAction00"));
|
518 | 0 |
status = false;
|
519 |
} |
|
520 | 0 |
break;
|
521 |
case STYLE_OPT:
|
|
522 | 0 |
value = option.getArgument(); |
523 | 0 |
if (value.equalsIgnoreCase("DOCUMENT") |
524 |
|| value.equalsIgnoreCase("RPC")
|
|
525 |
|| value.equalsIgnoreCase("WRAPPED")) {
|
|
526 | 0 |
emitter.setStyle(value); |
527 |
} else {
|
|
528 | 0 |
System.out.println(Messages.getMessage("j2woptBadStyle00"));
|
529 | 0 |
status = false;
|
530 |
} |
|
531 | 0 |
break;
|
532 |
case USE_OPT:
|
|
533 | 0 |
value = option.getArgument(); |
534 | 0 |
if (value.equalsIgnoreCase("LITERAL") |
535 |
|| value.equalsIgnoreCase("ENCODED")) {
|
|
536 | 0 |
emitter.setUse(value); |
537 |
} else {
|
|
538 | 0 |
System.out.println(Messages.getMessage("j2woptBadUse00"));
|
539 | 0 |
status = false;
|
540 |
} |
|
541 | 0 |
break;
|
542 |
case EXTRA_CLASSES_OPT:
|
|
543 | 0 |
try {
|
544 | 0 |
emitter.setExtraClasses(option.getArgument()); |
545 |
} catch (ClassNotFoundException e) {
|
|
546 | 0 |
System.out.println(Messages.getMessage("j2woptBadClass00",
|
547 |
e.toString())); |
|
548 | 0 |
status = false;
|
549 |
} |
|
550 | 0 |
break;
|
551 |
case IMPORT_SCHEMA_OPT:
|
|
552 | 0 |
emitter.setInputSchema(option.getArgument()); |
553 | 0 |
break;
|
554 |
case CLASSPATH_OPT:
|
|
555 | 0 |
ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(option.getArgument(), |
556 |
this.getClass().getClassLoader()));
|
|
557 | 0 |
break;
|
558 |
case IMPL_STYLE_OPT:
|
|
559 | 0 |
this.implStyle = option.getArgument();
|
560 | 0 |
break;
|
561 |
case CONTAINER_OPT:
|
|
562 | 0 |
this.container = option.getArgument();
|
563 | 0 |
break;
|
564 |
default :
|
|
565 | 0 |
break;
|
566 |
} |
|
567 | 25 |
return status;
|
568 |
} |
|
569 |
|
|
570 |
/**
|
|
571 |
* validateOptions
|
|
572 |
* This method is invoked after the options are set to validate
|
|
573 |
* the option settings.
|
|
574 |
*
|
|
575 |
* @return
|
|
576 |
*/
|
|
577 | 11 |
protected boolean validateOptions() { |
578 |
// // Can't proceed without a class name
|
|
579 |
// if ((className == null)) {
|
|
580 |
// System.out.println(Messages.getMessage("j2wMissingClass00"));
|
|
581 |
// printUsage();
|
|
582 |
//
|
|
583 |
// return false;
|
|
584 |
// }
|
|
585 |
|
|
586 |
// if (!locationSet
|
|
587 |
// && ((mode == Emitter.MODE_ALL)
|
|
588 |
// || (mode == Emitter.MODE_IMPLEMENTATION))) {
|
|
589 |
// System.out.println(Messages.getMessage("j2wMissingLocation00"));
|
|
590 |
// printUsage();
|
|
591 |
//
|
|
592 |
// return false;
|
|
593 |
// }
|
|
594 |
|
|
595 |
// Default to SOAP 1.2 JAX-RPC mapping
|
|
596 | 11 |
TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
|
597 | 11 |
tmr.doRegisterFromVersion("1.2");
|
598 | 11 |
emitter.setTypeMappingRegistry(tmr); |
599 | 11 |
return true; // a-OK |
600 |
} |
|
601 |
|
|
602 |
/**
|
|
603 |
* printUsage
|
|
604 |
* print usage information and quit.
|
|
605 |
*/
|
|
606 | 0 |
protected void printUsage() { |
607 | 0 |
String lSep = System.getProperty("line.separator");
|
608 | 0 |
StringBuffer msg = new StringBuffer();
|
609 | 0 |
msg.append("Java2WSDL "
|
610 |
+ Messages.getMessage("j2wemitter00")).append(lSep);
|
|
611 | 0 |
msg.append(Messages.getMessage("j2wusage00",
|
612 |
"java " + getClass().getName()
|
|
613 |
+ " [options] class-of-portType")).append(lSep);
|
|
614 | 0 |
msg.append(Messages.getMessage("j2woptions00")).append(lSep);
|
615 | 0 |
msg.append(CLUtil.describeOptions(options).toString()); |
616 | 0 |
msg.append(Messages.getMessage("j2wdetails00")).append(lSep);
|
617 | 0 |
System.out.println(msg.toString()); |
618 |
} |
|
619 |
|
|
620 |
/**
|
|
621 |
* @return
|
|
622 |
*/
|
|
623 | 0 |
public String getWsdlFilename() {
|
624 | 0 |
return wsdlFilename;
|
625 |
} |
|
626 |
|
|
627 |
/**
|
|
628 |
* @param string
|
|
629 |
*/
|
|
630 | 0 |
public void setWsdlFilename(String string) { |
631 | 0 |
wsdlFilename = string; |
632 |
} |
|
633 |
|
|
634 |
/**
|
|
635 |
* @return
|
|
636 |
*/
|
|
637 | 0 |
public String getClassName() {
|
638 | 0 |
return className;
|
639 |
} |
|
640 |
|
|
641 |
/**
|
|
642 |
* @param string
|
|
643 |
*/
|
|
644 | 0 |
public void setClassName(String string) { |
645 | 0 |
className = string; |
646 |
} |
|
647 |
|
|
648 |
/**
|
|
649 |
* @return
|
|
650 |
*/
|
|
651 | 11 |
public int getMode() { |
652 | 11 |
return mode;
|
653 |
} |
|
654 |
|
|
655 |
/**
|
|
656 |
* @return
|
|
657 |
*/
|
|
658 | 11 |
public String getWsdlImplFilename() {
|
659 | 11 |
return wsdlImplFilename;
|
660 |
} |
|
661 |
|
|
662 |
/**
|
|
663 |
* @param i
|
|
664 |
*/
|
|
665 | 0 |
public void setMode(int i) { |
666 | 0 |
mode = i; |
667 |
} |
|
668 |
|
|
669 |
/**
|
|
670 |
* @param string
|
|
671 |
*/
|
|
672 | 0 |
public void setWsdlImplFilename(String string) { |
673 | 0 |
wsdlImplFilename = string; |
674 |
} |
|
675 |
|
|
676 |
/**
|
|
677 |
* @return
|
|
678 |
*/
|
|
679 | 11 |
public Module getModule() {
|
680 | 11 |
return module;
|
681 |
} |
|
682 |
|
|
683 |
/**
|
|
684 |
* @return
|
|
685 |
*/
|
|
686 | 0 |
public String getModuleLocation() {
|
687 | 0 |
return moduleLocation;
|
688 |
} |
|
689 |
|
|
690 |
/**
|
|
691 |
* @param module
|
|
692 |
*/
|
|
693 | 0 |
public void setModule(Module module) { |
694 | 0 |
this.module = module;
|
695 |
} |
|
696 |
|
|
697 |
/**
|
|
698 |
* @param string
|
|
699 |
*/
|
|
700 | 0 |
public void setModuleLocation(String string) { |
701 | 0 |
moduleLocation = string; |
702 |
} |
|
703 |
|
|
704 |
/**
|
|
705 |
* @return
|
|
706 |
*/
|
|
707 | 11 |
public String getContanier() {
|
708 | 11 |
return container;
|
709 |
} |
|
710 |
|
|
711 |
/**
|
|
712 |
* @return
|
|
713 |
*/
|
|
714 | 11 |
public String getImplStyle() {
|
715 | 11 |
return implStyle;
|
716 |
} |
|
717 |
|
|
718 |
/**
|
|
719 |
* @param string
|
|
720 |
*/
|
|
721 | 0 |
public void setContanier(String string) { |
722 | 0 |
container = string; |
723 |
} |
|
724 |
|
|
725 |
/**
|
|
726 |
* @param string
|
|
727 |
*/
|
|
728 | 0 |
public void setImplStyle(String string) { |
729 | 0 |
implStyle = string; |
730 |
} |
|
731 |
|
|
732 | 11 |
public boolean isCompile() { |
733 | 11 |
return true; |
734 |
} |
|
735 |
|
|
736 | 11 |
public Map getProperties() {
|
737 | 11 |
return new HashMap(); |
738 |
} |
|
739 |
} |
|
740 |
|
|